Casper CBC: cbc-casper-js
https://github.com/sigp/cbc-casper-js/tree/f15b6927ca9268f81f9f52369e1c1d87f3994d11
description
each validator has the same weight 100 and random starting point (estimation) 0 or 1
choose from and to randomly, and send the message with from's estimation (consensus value) and justification (latest messages) to to until consensus achieved
consensus will achieve if and only if the ratio of the weights of all validators who are safe vs. those who are not has certain level or more
estimation will be safe if and only if safety ratio obtained by safety oracle has certain level or more
example
./casper.js random -n 3
simulation
simulate()
consensusAchieved(individualRatio, overallRatio)
check that the ratio of safe validators is grater or equals to? overallRatio
doRandomMessage()
select from and to from validators randomly
doMessage()
generateMsg()
sender: set myself as sender
estimate: getEstimateFromMsgs() from getLatestMsgHashes() and set it as estimate
get estimate (= decide the most voted consensus value by validators' weight) from the messages
justification: set getLatestMsgHashes() as justification
verifyMsgHash()
receive and parseMsg(msgHash)
verifyMsgHashLazyDeep()
verify messages recursively
from.getEstimate()
getEstimateFromMsgs()
from.findSafety() from the estimation
Given an estimate, return the ratio of the weights of all validators who are safe vs. those who are not
get estimate, safety ratio, and safe or not for each validator
write output
verifyMsgHash
justificationEstimateIsValid
justificationHasDuplicates
findEquivocation
findSafety
WIP
memo
message
sender
estimate
justification
estimate
by estimator
justification
hashes of latest messages from each validator
estimator
from messages to most voted message
#Casper